package com.kang.controller.feign;

import com.kang.entity.Essay;
import com.kang.feign.UserFeignClient;
import com.kang.util.WebResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "文章调用")
@RequestMapping("/admin/essay")
@Slf4j
public class EssayFeign {

    @Autowired
    private UserFeignClient essayFeignClient;


    @ApiOperation("删除个人文章")
    @PostMapping("deleteEssay")
    public WebResponse deleteEssay(@RequestBody Essay essay) {
        try {
            return WebResponse.resSuccess("删除个人文章成功",essayFeignClient.deleteEssay(essay));
        } catch (Exception ex) {
            log.error("删除个人文章失败",ex);
            return WebResponse.resFail("删除个人文章失败",null);
        }
    }


}
